package coms.dto;

import Util.Constant;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Event implements Serializable{
    
    private int id;
    private String description;
    private Date endDate;
    private String name;
    private Date startDate;
    private Conference conference;

    public Event(){

    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Conference getConference() {
        return conference;
    }

    public void setConference(Conference conference) {
        this.conference = conference;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }
    
        public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    
        public String getStartDateStr() {
        DateFormat df = new SimpleDateFormat(Constant.DATETIME_FORMAT);
        return startDate == null ? "" : df.format(startDate);
    }

    public String getEndDateStr() {
        DateFormat df = new SimpleDateFormat(Constant.DATETIME_FORMAT);
        return endDate == null ? "" : df.format(endDate);
    }
    
        public void setStartDateStr(String startDate) {
        DateFormat df = new SimpleDateFormat(Constant.DATETIME_FORMAT);
        try {
            this.startDate = df.parse(startDate);
        } catch (ParseException ex) {
            Logger.getLogger(Event.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void setEndDateStr(String endDate) {
        DateFormat df = new SimpleDateFormat(Constant.DATETIME_FORMAT);
        try {
            this.endDate = df.parse(endDate);
        } catch (ParseException ex) {
            Logger.getLogger(Event.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
}